package com.ml.mall.consts;

import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @description description
 * @author yx
 * @date 2021/8/16
 * @version 1.0
*/
public class PermissionConst {
    /**
     * analytics模块
     */
    //admin接口
    public static final String ADMIN_OVERVIEW = "/admin/overview";
    public static final String ADMIN_PURCHASE = "/admin/purchaser";
    public static final String ADMIN_PURCHASE_QUERY_REPORT_PAGE = "/admin/purchaser/query_report_page";
    public static final String ADMIN_PURCHASE_DETAIL = "/admin/purchaser/detail";
    public static final String ADMIN_PURCHASE_SPENT_BY_CATEGORY = "/admin/purchaser/spent_by_category";
    public static final String ADMIN_PURCHASE_SPENT_BY_SUPPLIER = "/admin/purchaser/spent_by_supplier";
    public static final String ADMIN_PURCHASE_SPENT_BY_PRODUCT = "/admin/purchaser/spent_by_product";
    public static final String ADMIN_INDUSTRY_QUERY_TOP = "/admin/industry/query_top";
    public static final String ADMIN_INDUSTRY_QUERY_PAGE = "/admin/industry/query_page";
    public static final String ADMIN_INDUSTRY_QUERY_ONE = "/admin/industry/query_one";
    public static final String ADMIN_CATEGORY_QUERY_TOP = "/admin/category/query_top";
    public static final String ADMIN_CATEGORY_QUERY_PAGE = "/admin/category/query_page";
    public static final String ADMIN_INDUSTRY_SUPPLIER_QUERY_PAGE = "/admin/industry/supplier/query_page";
    public static final String ADMIN_CATEGORY_QUERY_REPORT_PAGE = "/admin/category/query_report_page";
    public static final String ADMIN_CATEGORY_QUERY_ONE_DETAIL_SALES_SUPPLIER = "/admin/category/query_one_detail_sales_supplier";
    public static final String ADMIN_CATEGORY_QUERY_SUBCATEGORY_TOTALFEE = "/admin/category/query_subcategory_totalfee";
    public static final String ADMIN_VARIANT_QUERY_TOP = "/admin/variant/query_top";
    public static final String ADMIN_VARIANT_QUERY_ONE = "/admin/variant/query_one";
    public static final String ADMIN_VARIANT_QUERY_PAGE = "/admin/variant/query_page";
    public static final String ADMIN_SUPPLIER_QUERY_REPORT = "/admin/supplier/query_report";
    public static final String ADMIN_SUPPLIER_QUERY_PAGE = "/admin/supplier/query_page";
    public static final String ADMIN_SUPPLIER_QUERY_ONE = "/admin/supplier/query_one";
    public static final String ADMIN_SUPPLIER_QUERY_ONE_BY_CATEGORY = "/admin/supplier/query_one_by_category";
    public static final String ADMIN_SUPPLIER_QUERY_ONE_BY_PURCHASE = "/admin/supplier/query_one_by_purchase";
    public static final String ADMIN_COUPON_QUERY_ONE = "/admin/coupon/query_one";

    //coupon接口
    public static final String COUPON_DAY_DETAIL = "/coupon/day_detail";
    public static final String COUPON_ORDER_PAGE = "/coupon/coupon_order_page";

    //partners接口
    public static final String PARTNER_REGISTER_COMPANY = "/partners/register_company";
    public static final String PARTNER_SUPPLIER_QUERY_REPORT = "/partners/supplier/query_report";
    public static final String PARTNER_SUPPLIER_QUERY_PAGE = "/partners/supplier/query_page";
    public static final String PARTNER_SUPPLIER_QUERY_ONE_REPORT = "/partners/supplier/query_one_report";
    public static final String PARTNER_SUPPLIER_QUERY_CATEGORY_SALES_PAGE = "/partners/supplier/query_category_sales_page";


    //purchase接口
    public static final String PURCHASE_OVERVIEW_QUERY_REPORT = "/purchase/overview/query_report";
    public static final String PURCHASE_SPENT_QUERY_REPORT = "/purchase/spent/query_report";
    public static final String PURCHASE_SUPPLIER_QUERY_REPORT = "/purchase/supplier/query_report";
    public static final String PURCHASE_SUPPLIER_QUERY_PAGE = "/purchase/supplier/query_page";
    public static final String PURCHASE_VARIANT_QUERY_PAGE = "/purchase/variant/query_page";
    public static final String PURCHASE_VARIANT_QUERY_TOP = "/purchase/variant/query_top";
    public static final String PURCHASE_VARIANT_QUERY_ONE = "/purchase/variant/query_one";

    //supplier接口
    public static final String SUPPLIER_PURCHASE_CATEGORY_QUERY_PAGE = "/supplier/purchase/category/query_page";
    public static final String SUPPLIER_CATEGORY_QUERY_TOP = "/supplier/category/query_top";
    public static final String SUPPLIER_COUNTRY_QUERY_REPORT = "/supplier/country/query_report";
    public static final String SUPPLIER_CATEGORY_QUERY_PAGE = "/supplier/category/query_page";
    public static final String SUPPLIER_CATEGORY_QUERY_ONE = "/supplier/category/query_one";
    public static final String SUPPLIER_CATEGORY_QUERY_ONE_SUBS_REPORT = "/supplier/category/query_one_subs_report";
    public static final String SUPPLIER_VARIANT_QUERY_TOP = "/supplier/variant/query_top";
    public static final String SUPPLIER_VARIANT_QUERY_PAGE = "/supplier/variant/query_page";
    public static final String SUPPLIER_VARIANT_QUERY_ONE = "/supplier/variant/query_one";
    public static final String SUPPLIER_ORDER_REPORT = "/supplier/order/query_report";
    public static final String SUPPLIER_PURCHASE_QUERY_TOP = "/supplier/purchase/query_top";
    public static final String SUPPLIER_PURCHASE_QUERY_ONE_REPORT = "/supplier/purchase/query_one_report";
    public static final String SUPPLIER_PURCHASE_QUERY_PAGE = "/supplier/purchase/query_page";



    /**
     * authentication模块
     */
    //category接口
    public static final String CATEGORY_NEW = "/common/category/new";
    public static final String CATEGORY_SEARCH = "/common/category/search";
    public static final String CATEGORY_EDIT = "/common/category/edit";
    public static final String CATEGORY_DEL = "/common/category/del";
    public static final String CATEGORY_QUERY_TREE = "/common/category/query_tree";
    public static final String CATEGORY_QUERY_PAGE = "/common/category/query_page";
    public static final String CATEGORY_ADD_SUB = "/common/category/add_sub";
    public static final String CATEGORY_QUERY_LEVEL1 = "/common/category/query_level1";
    public static final String CATEGORY_QUERY_ALL_SUB = "/common/category/query_all_sub";

    //file接口
//    public static final String FILE_UPLOAD_FILE = "/file/uploadFile"; //放行
    public static final String FILE_DELETE_FILE = "/file/deleteFile";

    //company接口
    public static final String COMPANY_NEW = "/company/new";
    public static final String COMPANY_EDIT = "/company/edit";
    public static final String COMPANY_DEL = "/company/del";
    public static final String COMPANY_QUERY_ONE = "/company/query_one";
    public static final String COMPANY_SUPPLIER_OF_STEP = "/company/supplier/of_step";
    public static final String COMPANY_QUERY_PAGE = "/company/query_page";
//    public static final String COMPANY_REGISTER = "/company/register"; //放行
    public static final String COMPANY_SEND_VERIFIC_CODE = "/company/sendVerificCode";
//    public static final String COMPANY_GET_IMAGE = "/company/getImage"; //放行
//    public static final String COMPANY_GET_VERIFY = "/company/getverfy"; //放行
    public static final String COMPANY_QUERY_USER = "/company/user/query";
    public static final String COMPANY_USER_ADD = "/company/user/add";
    public static final String COMPANY_USER_EDIT = "/company/user/edit";
    public static final String COMPANY_USER_DEL = "/company/user/del";
    public static final String COMPANY_INVITE_CREATE_USER = "/company/invite/create_user";
    public static final String COMPANY_INFO_LEVEL_QUERY = "/company/info_level/query";
    public static final String COMPANY_REMARK_ADD = "/company/remark/add";

    //logistics接口
    public static final String LOGISTICS_EDIT = "/logistics/edit";

    //country接口
    public static final String COMMON_COUNTRY_NEW = "/common/country/new";
    public static final String COMMON_COUNTRY_QUERY_ALL = "/common/country/query_all";

    //states接口
    public static final String COMMON_STATES_NEW = "/common/states/new";
    public static final String COMMON_STATES_QUERY_PAGE = "/common/states/query_page";
    public static final String COMMON_STATES_DEL = "/common/states/del";

    //credit接口
    public static final String CREDIT_NEW = "/credit/new";
    public static final String CREDIT_EDIT = "/credit/edit";
    public static final String CREDIT_QUERY_ONE = "/credit/query_one";
    public static final String CREDIT_QUERY_PAGE = "/credit/query_page";
    public static final String CREDIT_ADD_RECORD = "/credit/add_record";
    public static final String CREDIT_QUERY_CHANGE_RECORD = "/credit/query_change_record";

    //deduct接口
    public static final String DEDUCT_EDIT = "/deduct/edit";
    public static final String DEDUCT_QUERY = "/deduct/query";

    //industry接口
    public static final String INDUSTRY_NEW = "/industry/new";
    public static final String INDUSTRY_EDIT = "/industry/edit";
//    public static final String INDUSTRY_QUERY_PAGE = "/industry/query_page"; //放行

    //exception_log接口
    public static final String EXCEPTION_LOG_QUERY = "/exception_log/query";

    //operation_log接口
    public static final String OPERATION_LOG_QUERY = "/operation_log/query";
    public static final String OPERATION_LOG_DOWNLOAD = "/operation_log/download";

    //notification接口
    public static final String NOTIFICATION_QUERY_PAGE = "/notification/query_page";
    public static final String NOTIFICATION_QUERY_ONE = "/notification/query_one";
    public static final String NOTIFICATION_NEW = "/notification/new";
    public static final String NOTIFICATION_EDIT = "/notification/edit";
    public static final String NOTIFICATION_DEL = "/notification/del";

    //dim/partner接口
    public static final String DIM_PARTNER_INVITER_SUPPLIER = "/dim/partner/inviter_supplier";
    public static final String DIM_PARTNER_INVITER_PARTENER = "/dim/partner/inviter_partener";
    public static final String DIM_PARTNER_NEW = "/dim/partner/new";
    public static final String DIM_PARTNER_QUERY_ONE = "/dim/partner/query_one";
    public static final String DIM_PARTNER_QUERY_PAGE = "/dim/partner/query_page";
    public static final String DIM_PARTNER_DEL_RELETION = "/dim/partner/del_reletion";
    public static final String DIM_PARTNER_ALLOCATION_SUPPLIER = "/dim/partner/allocation_supplier";

    //setting接口
    public static final String SETING_NEW = "/seting/new";
    public static final String SETING_EDIT = "/seting/edit";
    public static final String SETING_QUERY_SETING = "/seting/query_seting";

    //permission接口
    public static final String PERMISSION_QUERY = "/permission/query";
    public static final String PERMISSION_NEW = "/permission/new";
    public static final String PERMISSION_EDIT = "/permission/edit";
    public static final String PERMISSION_DEL = "/permission/del";

    //role接口
    public static final String ROLE_QUERY = "/role/query";
    public static final String ROLE_NEW = "/role/new";
    public static final String ROLE_EDIT = "/role/edit";
    public static final String ROLE_DEL = "/role/del";

    //role_permission接口
    public static final String ROLE_PERMISSION_QUERY = "/role_permission/query";
    public static final String ROLE_PERMISSION_NEW = "/role_permission/new";
    public static final String ROLE_PERMISSION_DEL = "/role_permission/del";

    //subscription接口
    public static final String SUBSCRIPTION_QUERY_PAGE = "/subscription/query_page";
    public static final String SUBSCRIPTION_NEW = "/subscription/new";
    public static final String SUBSCRIPTION_EDIT = "/subscription/edit";

    //subscription_query_page接口
    public static final String SUBSCRIPTION_ROUTING_QUERY_PAGE = "/subscription_routing/query_page";
    public static final String SUBSCRIPTION_ROUTING_NEW = "/subscription_routing/new";
    public static final String SUBSCRIPTION_ROUTING_DEL = "/subscription_routing/del";

    //user接口
//    public static final String USER_LOGIN = "/user/login"; //放行
//    public static final String USER_LOGOUT = "/user/logout"; //放行
    public static final String USER_QUERY_SAME_NAME = "/user/query/same_name";
//    public static final String USER_FORGET_PASSWD_EMAIL = "/user/forgetPasswdEmail"; //放行
//    public static final String USER_FORGET_PASSWD = "/user/forgetPasswd"; //放行
    public static final String USER_QUERY_ONE = "/user/query_one";
    public static final String USER_QUERY_PAGE = "/user/query_page";
    public static final String USER_NEW = "/user/new";
    public static final String USER_EDIT_INFO = "/user/edit/info";
    public static final String USER_EDIT_RESETPWD = "/user/edit/resetpwd";
    public static final String USER_EDIT_NEWPWD = "/user/edit/newpwd";
    public static final String USER_MENU = "/user/menu";
    public static final String USER_PERMISSIONS = "/user/permissions";
    public static final String USER_CHANGE_COMPANY = "/user/change/company";

    //user_role接口
    public static final String USER_ROLE_QUERY = "/user_role/query";
    public static final String USER_ROLE_NEW = "/user_role/new";
    public static final String USER_ROLE_DEL = "/user_role/del";

    //tax接口
    public static final String TAX_NEW = "/tax/new";
    public static final String TAX_EDIT = "/tax/edit";
    public static final String TAX_QUERY_PAGE = "/tax/query_page";


    /**
     * dim模块
     */
    //banner接口
    public static final String BANNER_NEW = "/banner/new";
    public static final String BANNER_DEL = "/banner/del";
    public static final String BANNER_QUERY = "/banner/query";
    public static final String BANNER_EDIT = "/banner/edit";
    public static final String BANNER_CLICK = "/banner/click";
    public static final String BANNER_QUERY_BY_TYPE = "/banner/query_by_type";

    //catalogue接口
    public static final String CATALOGUE_NEW = "/catalogue/new";
    public static final String CATALOGUE_QUERY = "/catalogue/query";
    public static final String CATALOGUE_ADD_PRODUCT = "/catalogue/add_product";
    public static final String CATALOGUE_QUERY_ALL = "/catalogue/query_all";
    public static final String CATALOGUE_QUERY_CATALOGUE_PRODUCT = "/catalogue/query_catalogue_product";
    public static final String CATALOGUE_DEL_CATALOGUE_BY_ID = "/catalogue/del_catalogue_by_id";
    public static final String CATALOGUE_EDIT_CATALOGUE_VARIANT = "/catalogue/edit_catalogue_variant";
    public static final String CATALOGUE_DEL_VARIANT_FROM_CATALOG = "/catalogue/del_variant_from_catalog";
    public static final String CATALOGUE_EDIT = "/catalogue/edit";
    public static final String CATALOGUE_EDIT_NAME = "/catalogue/edit_name";

    //dashboard接口
    public static final String DASHBOARD_QUERY_ADMIN = "/dashboard/query_admin";
    public static final String DASHBOARD_RECENT_ORDER = "/dashboard/recent_order";
    public static final String DASHBOARD_RECENT_DELIVERY = "/dashboard/purchase/recent_delivery";
    public static final String DASHBOARD_PURCHASE_QUERY = "/dashboard/purchase/query";
    public static final String DASHBOARD_SUPPLIER_QUERY = "/dashboard/supplier/query";
    public static final String DASHBOARD_PARTNER_QUERY = "/dashboard/partner/query";



    /**
     * order模块
     */
    //delivery接口
    public static final String DELIVERY_NEW = "/delivery/new";
    public static final String DELIVERY_EDIT = "/delivery/edit";

    //addr接口
    public static final String ADDR_QUERY_ORDER_ADDR = "/addr/query_order_addr";

    //order接口
    public static final String ORDER_QUERY_PAGE = "/order/query_page";
    public static final String ORDER_BUYER_QUERY_ONE = "/order/buyer/query_one";
    public static final String ORDER_NEW = "/order/new";
    public static final String ORDER_EDIT = "/order/edit";

    // order/couppon接口
    public static final String ORDER_COUPPON_CHECK = "/order/couppon/check";

    // supplier接口
    public static final String SUPPLIER_M_QUERY_PAGE = "/supplier/m_query_page";
    public static final String SUPPLIER_QUERY_ONE = "/supplier/query_one";
    public static final String SUPPLIER_EDIT = "/supplier/edit";


    /**
     * product模块
     */
    //coupon接口
    public static final String COUPON_NEW = "/coupon/new";
    public static final String COUPON_EDIT = "/coupon/edit";
    public static final String COUPON_DEL = "/coupon/del";
    public static final String COUPON_QUERY_PAGE = "/coupon/query_page";
    public static final String COUPON_QUERY_ONE = "/coupon/query_one";

    //product接口
    public static final String PRODUCT_QUERY_PAGE = "/product/query_page";
    public static final String PRODUCT_QUERY_TREE = "/product/query_tree";
    public static final String PRODUCT_SHOP_PAGE = "/product/shop_page";
    public static final String PRODUCT_QUERY_ONE = "/product/query_one";
    public static final String PRODUCT_NEW = "/product/new";
    public static final String PRODUCT_EDIT = "/product/edit";
    public static final String PRODUCT_DEL = "/product/del";

    //shop接口
    public static final String SHOP_QUERY_SUPPLIER_PAGE = "/shop/query_supplier_page";
    public static final String SHOP_QUERY_RECOMMOND = "/shop/query_recommond";
    public static final String SHOP_SHOP_QUERY_PAGE_BY_KEYWORD_STATES = "/shop/shop_query_page_by_keyword_states";
    public static final String SHOP_SHOP_QUERY_PAGE_BY_CATEGORY = "/shop/shop_query_page_by_category";
    public static final String SHOP_SHOP_QUERY_SALES = "/shop/shop_query_sales";
    public static final String SHOP_SHOP_PRODUCT_QUERY_ONE = "/shop/shop_product_query_one";
    public static final String SHOP_SHOP_QUERY_BY_SUPPLIER = "/shop/shop_query_by_supplier";
    public static final String SHOP_SHOP_QUERY_RELATION = "/shop/shop_query_relation";

    //variant接口
    public static final String VARIANT_QUERY_ONE = "/variant/query_one";
    public static final String VARIANT_QUERY_ALL = "/variant/query_all";
    public static final String VARIANT_NEW = "/variant/new";
    public static final String VARIANT_EDIT = "/variant/edit";
    public static final String VARIANT_DEL = "/variant/del";
    public static final String VARIANT_SALES_NEW = "/variant/sales/new";
    public static final String VARIANT_SALES_EDIT = "/variant/sales/edit";
    public static final String VARIANT_RECOMMEND_NEW = "/variant/recommend/new";
    public static final String VARIANT_VARIANT_STATE_EDIT = "/variant/VariantState/edit";

    //variant_recommend接口
    public static final String PRODUCT_RECOMMEND_NEW = "/variant_recommend/new";
    public static final String PRODUCT_RECOMMEND_DEL = "/variant_recommend/del";
    public static final String PRODUCT_RECOMMEND_EDIT = "/variant_recommend/edit";
    public static final String PRODUCT_RECOMMEND_QUERY_ALL = "/variant_recommend/query_all";


    /**
     * quartz模块
     */
    //job接口
    public static final String JOB_ADD = "/job/add";
    public static final String JOB_LIST = "/job/list";
    public static final String JOB_TRIGGER = "/job/trigger";
    public static final String JOB_PAUSE = "/job/pause";
    public static final String JOB_RESUME = "/job/resume";
    public static final String JOB_REMOVE = "/job/remove";


    /**
     * shopping-cart模块
     */
    //shopping接口
    public static final String SHOPPING_NEW = "/shopping/new";
    public static final String SHOPPING_EDIT = "/shopping/edit";
    public static final String SHOPPING_CLEAR = "/shopping/clear";
    public static final String SHOPPING_DEL = "/shopping/del";
    public static final String SHOPPING_QUERY = "/shopping/query";

    //product接口
    public static final String PRODUCT_SHOP_COMPARISON_ADD = "/product/shop_comparison_add";
    public static final String PRODUCT_SHOP_COMPARISON_QUERY = "/product/shop_comparison_query";
    public static final String PRODUCT_SHOP_COMPARISON_DEL = "/product/shop_comparison_del";


    /**
     * 检查重复权限
     * @param args
     */
    public static void main(String[] args) {
        //获取常量
        Class<PermissionConst> permissionConstClass = PermissionConst.class;
        List<Field> fields = Arrays.asList(permissionConstClass.getFields());

        System.out.println("fields num:"+fields.size());

        //获取常量值
        List<Object> values = fields.stream().map(field -> {
            try {
                return field.get(null);
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
            return null;
        }).collect(Collectors.toList());

        //获取去重的值
        List<Object> distinctValues = values.stream().distinct().collect(Collectors.toList());
        System.out.println("distinct values num:" + distinctValues.size());

        //常量值计数
        Map<Object, Integer> valueCountMap = values.stream().collect(Collectors.toMap(v -> v, v -> 1, (a, b) -> a + b));
        //重复值计数map
        Map<Object, Integer> sameValueMap = valueCountMap.entrySet().stream().filter(entry -> entry.getValue() > 1).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
        System.out.println("sameValue:"+sameValueMap);
    }
}
